//
//  UIBarButtonItem+Extensions.swift
//  Weibo
//
//  Created by yinbo on 2018/2/28.
//  Copyright © 2018年 yinbo. All rights reserved.
//

import Foundation
extension UIBarButtonItem{
    convenience init(title:String,fontSize:CGFloat=16,target:AnyObject?,action:Selector,isBack:Bool=false){
        let btn:UIButton = UIButton.cz_textButton(title , fontSize: fontSize , normalColor: UIColor.darkGray, highlightedColor: UIColor.orange)
        if isBack{
            let imagename = "navigationbar_back_withtext"
            btn.setImage(UIImage(named:imagename), for: .normal)
            btn.setImage(UIImage(named:imagename+"_highlighted"), for: .highlighted)
                btn.sizeToFit()
        }
        btn.addTarget(target, action: action, for: .touchUpInside)
        //navigationItem.leftBarButtonItem = UIBarButtonItem(customView: btn)
        self.init(customView:btn)
    }
}
